/********************************************************************
	created:	2008/10/04
	created:	4:10:2008   14:32
	filename: 	h:\SimoneEngine\qianye\src\qylib\tuningkit\qyLogger.h
	author:		Xiong Jiayu
	copyright:  
	purpose:	
*********************************************************************/
#pragma once

#ifndef __QYLOGGER_H__
#define __QYLOGGER_H__

#include "../common/qyCommon.h"
#include "../memsys/qyString.h"
#include <ostream>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
/*
===========================================
class qyLogger
===========================================
*/
/** qyLogger is the handle of a log file, the file is save as HTML, 
and highlight color for error message

*/
class qyLogger
{
public:
					qyLogger();
					qyLogger( bool bSwitchLogTime, bool bFlageFinishTime );
	virtual 		~qyLogger();

	bool			SetLogFile( const std::string &fileName );

	void			LogMsg( const std::string &message, bool ifline = true, const char *style = NULL );
	void			LogMsg( const double message, bool ifline = true, const char *style = NULL );
	void			LogMsg( const long message, bool ifline = true, const char *style = NULL );
	void			LogMsg( const unsigned long message, bool ifline = true, const char *style = NULL );
private:
	void			LogHead( const char *style );
	void			LogTime();
	void			LogEnd();
private:
	bool			m_bSwitchLogTime;
	bool			m_bFlagFinishLine;
	bool			m_bInited;
	std::ofstream	m_file;
};


#endif

